using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UIElements;

public class UI_Dead : MonoBehaviour, IPointerDownHandler
{
    public void ShowDeadUI()
    {
        StartCoroutine("IShowDeadUI");
    }

    public void UnShowDeadUI()
    {
        UIManager.UIShow(this.gameObject, false);
    }

    public IEnumerator IShowDeadUI()
    {
        CanvasGroup cg = GetComponent<CanvasGroup>();
        while (cg.alpha < 1)
        {
            cg.alpha += 2 * Time.deltaTime;
            yield return null;
        }
        cg.interactable = true;
        cg.blocksRaycasts = true;
    }

    public void OnPointerDown(PointerEventData eventData)
    {
        GameManager.instance.ReloadScence();
    }
}
